<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Cookie_api extends CI_Controller {

    const ERROR_TAB = 'error';

    public function __construct(){
        parent::__construct();
        $this->load->database();
        $this->load->model('keyword/cookie_model');
        $this->load->model('keyword/cookienew_model');
        $this->load->helper('MY_auth_verification');
        $this->load->helper('my_common_helper');
        $this->load->library('error_code_library');
        $this->auth_first();
    }

    function auth_first() {
        $auth_verification_result = authentication($this, $this->input->post());
        if(is_array($auth_verification_result) && array_key_exists(self::ERROR_TAB,$auth_verification_result)) {
            echo json_encode($auth_verification_result);
            exit;
        } else {
            return true;
        }
    }

    function get_sina_cookie_count(){
        $platform = 'sina';
        $count = $this->cookie_model->get_cookie_count($platform);

        json_msg(0, array('count' => $count));
    }
    
    function get_sina_cookienew_count(){
    	$platform = 'sina';
    	$count = $this->cookienew_model->get_cookie_count($platform);
    
    	json_msg(0, array('count' => $count));
    }
}
